<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>GCANet and FFA Show Image</title>

  <style>
    #submitButton_G{
      height:40px;
      width:150px;
      background-color: #6ba9ec;
      margin-top:20px;
      margin-left:430px;
    }
    #submitButton_F{
      height:40px;
      width:150px;
      background-color: #6ba9ec;
      margin-top:20px;
      margin-left:430px;
    }
  </style>
  <script>
    function downloadImg_G(){
      var img = document.getElementById('dehazeImg_G'); // 获取要下载的图片
      var url = img.src;                            // 获取图片地址
      var a = document.createElement('a');          // 创建一个a节点插入的document
      var event = new MouseEvent('click')           // 模拟鼠标click点击事件
      a.download = 'DehazeImg.png'                  // 设置a节点的download属性值
      a.href = url;                                 // 将图片的src赋值给a节点的href
      a.dispatchEvent(event)                        // 触发鼠标点击事件
    }
    function downloadImg_F(){
      var img = document.getElementById('dehazeImg_F'); // 获取要下载的图片
      var url = img.src;                            // 获取图片地址
      var a = document.createElement('a');          // 创建一个a节点插入的document
      var event = new MouseEvent('click')           // 模拟鼠标click点击事件
      a.download = 'DehazeImg.png'                  // 设置a节点的download属性值
      a.href = url;                                 // 将图片的src赋值给a节点的href
      a.dispatchEvent(event)                        // 触发鼠标点击事件
    }
  </script>
</head>
<body>
	<div>
		<div>
			<h3>GCANet：</h3>
			<div style="float: left;">
				<img th:src="@{'data:img/png;base64,'+${img_h}}" height="500px" width="500px"/>
				<img th:src="@{'data:img/png;base64,'+${img_G}}" id="dehazeImg_G" height="500px" width="500px"/>
			</div>
			<div style="margin-top: 270px;margin-left: 1100px;">
				<h4>运行时间(s)：</h4>
				  <h4 th:text="${time_G}"></h4>
			</div>
			
			<button class="downloadBtn" type="button" onclick="downloadImg_G()" id="submitButton_G">下载图片</button>
		</div>
		
		<div>
			<br><br>
			<h3>FFA：</h3>
			<div style="float: left;">
				<img th:src="@{'data:img/png;base64,'+${img_h}}" height="500px" width="500px"/>
				<img th:src="@{'data:img/png;base64,'+${img_F}}" id="dehazeImg_F" height="500px" width="500px"/>
			</div>
			<div style="margin-top: 270px;margin-left: 1100px;">
				<h4>运行时间(s)：</h4>
				  <h4 th:text="${time_F}"></h4>
			</div>
			
			<button class="downloadBtn" type="button" onclick="downloadImg_F()" id="submitButton_F">下载图片</button>
		</div>
		
	</div>
</body>
</html>
